Mapsend: Preserve icons on the way in and out.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jan 2003 02:43:32 +0000 (02:43 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jan 2003 02:43:32 +0000 (02:43 +0000)
gpsbabel/mapsend.c

index 5644133be3f8d4d15619e2f1381cd388f3ab0e74..b0e9a774f5af19dcf56664a5445a1a7b1f596ed7 100644 (file)
@@ -228,6 +228,8 @@ mapsend_wpt_read(void)
                wpt_tmp->position.altitude.altitude_meters = wpt_alt;
                wpt_tmp->position.latitude.degrees = -wpt_lat;
                wpt_tmp->position.longitude.degrees = wpt_long;
+               sprintf(tbuf, "%c", wpt_icon + 'a');
+               wpt_tmp->icon_descr = mag_find_descr_from_token(tbuf);
 
                waypt_add(wpt_tmp);
        }
@@ -315,6 +317,7 @@ mapsend_waypt_pr(const waypoint *waypointp)
        double flong;
        double flat;
        static int cnt = 0;
+       char *iconp;
        const char *sn = global_opts.synthesize_shortnames ? 
                mkshort(mkshort_handle, waypointp->description) :
                waypointp->shortname;
@@ -323,14 +326,23 @@ mapsend_waypt_pr(const waypoint *waypointp)
        fwrite(&c, 1, 1, mapsend_file_out);
        fwrite(sn, c, 1, mapsend_file_out);
 
-       c = strlen(waypointp->description);
+       if (waypointp->description) 
+               c = strlen(waypointp->description);
+       else
+               c = 0;
        fwrite(&c, 1, 1, mapsend_file_out);
        fwrite(waypointp->description, c, 1, mapsend_file_out);
 
        /* #, icon, status */
 n = ++cnt;
        my_fwrite4(&n, mapsend_file_out);
-n = 0;
+
+       if (waypointp->icon_descr) {
+               iconp = mag_find_token_from_descr(waypointp->icon_descr);
+               n = iconp[0] - 'a';
+       } else  {
+               n = 0;
+       }
        fwrite(&n, 1, 1, mapsend_file_out);
 n = 1;
        fwrite(&n, 1, 1, mapsend_file_out);